/*function ListNode(x){
    this.val = x;
    this.next = null;
}*/
function FindFirstCommonNode(pHead1, pHead2)
{
    // write code here
    // 初始的时候设置pa和pb分别等于ph1 和ph2的头结点
    var pa = pHead1
    var pb = pHead2
    while(pa !== pb){
      // 只要pa和pb不相等 那么就按照特定的轨迹移动
      if(pa){
        pa = pa.next
      }else{
        pa = pHead2
      }
      if(pb){
        pb = pb.next
      }else{
        pb = pHead1
      }
    }
    return pa
}
module.exports = {
    FindFirstCommonNode : FindFirstCommonNode
};